package pro.survey.analyzer.imp.window;

import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.scene.layout.HBoxBuilder;
import javafx.scene.layout.VBox;
import javafx.scene.layout.VBoxBuilder;
import javafx.stage.Modality;
import javafx.stage.Stage;

/**
 *
 * @author Adrian
 */
public class ImportsWindow {
    
    private Stage dialogStage;
    private ListView<String> list;
    private ButtonOK buttonOK;
    private ButtonCancel buttonCancel;
    private static ImportsWindow instance = null;
    
    /**
     * 
     * @return ImportsWindow
     */
    public static ImportsWindow getInstance() {
        if (instance == null) {
            instance = new ImportsWindow();
        }
        return instance;
    }
    
    private ImportsWindow() {}
    
    public void init() {
        dialogStage = new Stage();
        list = new ImportList();
        buttonOK = new ButtonOK(dialogStage);
        buttonCancel = new ButtonCancel(dialogStage);
        dialogStage.initModality(Modality.APPLICATION_MODAL);
        VBox box = VBoxBuilder.create().spacing(10).alignment(Pos.CENTER).
           children(list, HBoxBuilder.create().spacing(10).
           alignment(Pos.CENTER).children(buttonOK, buttonCancel).
           padding(new Insets(10)).build()).build();
        Scene dialogScene = new Scene(box);
        dialogStage.setScene(dialogScene);
        dialogStage.show();
    }
    
    public ListView<String> getList() {
        return list;
    }

    public ButtonOK getButtonOK() {
        return buttonOK;
    }

    public ButtonCancel getButtonCancel() {
        return buttonCancel;
    }
}


